import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RefundVO, RefundForm, RefundQuery } from '@/api/cemetery/refund/types';

/**
 * 查询退款列表
 * @param query
 * @returns {*}
 */

export const listRefund = (query?: RefundQuery): AxiosPromise<RefundVO[]> => {
  return request({
    url: '/cemetery/refund/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询退款详细
 * @param id
 */
export const getRefund = (id: string | number): AxiosPromise<RefundVO> => {
  return request({
    url: '/cemetery/refund/' + id,
    method: 'get'
  });
};

/**
 * 新增退款
 * @param data
 */
export const addRefund = (data: RefundForm) => {
  return request({
    url: '/cemetery/refund',
    method: 'post',
    data: data
  });
};

/**
 * 修改退款
 * @param data
 */
export const updateRefund = (data: RefundForm) => {
  return request({
    url: '/cemetery/refund',
    method: 'put',
    data: data
  });
};

/**
 * 删除退款
 * @param id
 */
export const delRefund = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/refund/' + id,
    method: 'delete'
  });
};
